#README: advanced version of pic grabber, works through atomic2, modify board= to your need,	 
#works through bbsfind in a incremental way, only new attachment posts grabbed, all jpg saved 	
#jpg files renamed to boardname_post-id.att-id.jpg, batch replace all "picture" to e.g. "myphoto" 	

wget -O board.htm --no-cache "http://www.newsmth.net/bbsbfind.php?q=1&board=picture&dt=1&ag=on&og="	 

cat board.htm |grep bbsqry | sed  -e "s/.*&id=/http:\/\/www\.newsmth\.net\/atomic2\.php\?act=article\&board=picture\&id=/g" | sed  -e "s/\">.*//g" > picture_posturl.list	 
rm -f board.htm	 

#ifdef incremental_readings 	
touch picture_posturl_old.list 		
diff picture_posturl.list picture_posturl_old.list | grep "<" | sed -e "s/< //g" > picture_posturl_diff.list 	
mv picture_posturl.list picture_posturl_old.list 	
wget -O postall.htm -i picture_posturl_diff.list 	
rm -f picture_posturl_diff.list      
#else              
#wget -O postall.htm -i picture_posturl.list	 
#endif       

cat postall.htm | tr -s "<li>" "\n" | grep "att\.php" | sed -e "s/.*att\.php/http:\/\/www\.newsmth\.net\/att\.php/g" | sed -e "s/' target=.*//g" > picurl.list 	

wget -nd -r -A jpg -i picurl.list 	
rm -f postall.htm 	

#rename -f "s/att\.php\?n\.//g" att*jpg  	
find . -name "att*jpg" | while read jpgfilename; do mv -f $jpgfilename $(echo $jpgfilename| sed -e "s/att.php?n.[0-9]*./picture_/g"); done  	

rm -f picurl.list  	
#mogrify -resize 640x480 *.jpg   	
